/**
 * @Author 天下无敌
 * @Date 
 * @AIDE AIDE+ 
 */
package com.ecs.core.utils;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.Gdx;

public class LoadPath{

	public ObjectMap<String,Array<String>> loadPath = new ObjectMap<>();
	
	public static LoadPath formJson(String path){
		return new Json().fromJson(LoadPath.class,Gdx.files.internal(path));
	}

	public void loadAll(AssetManager manager) {
		for (String className : loadPath.keys()) {
			try {
				Class<?> type = Class.forName(className);  // 动态加载类
				Array<String> typePaths = loadPath.get(className);
				for (String path : typePaths) {
					manager.load(path, type);
				}
			} catch (ClassNotFoundException e) {
				Gdx.app.error("LoadPath", "Class not found: " + className, e);
			}
		}
	}
}
